Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-has-pseudo

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-has-pseudo

Style elements relative to other elements in CSS

  • 6.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is css-has-pseudo?

The css-has-pseudo package is a tool designed to polyfill CSS :has() pseudo-class support in environments where it is not natively available. This package enables developers to use the :has() selector in their CSS, allowing for more complex styling scenarios based on the presence of descendants in the DOM.

What are css-has-pseudo's main functionalities?

Polyfill for :has() pseudo-class

This feature allows developers to use the :has() CSS pseudo-class in environments that do not support it natively. The code sample demonstrates how to import the polyfill and apply a CSS rule using :has() to style an unordered list with a blue border if it contains an 'li' element with the class 'active'.

import 'css-has-pseudo';

// Example CSS using :has()
const style = `
  ul:has(> li.active) {
    border: 1px solid blue;
  }
`;

// Apply styles to document
const styleSheet = document.createElement('style');
styleSheet.innerText = style;
document.head.appendChild(styleSheet);

Other packages similar to css-has-pseudo

Keywords

FAQs

Package last updated on 13 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc